package aspirecn.project3.mapper;

import aspirecn.project3.model.DetailPicAdress;
import aspirecn.project3.model.GoodsDetail;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DetailPictureAdressMapper {
    @Select("SELECT * FROM detail_picture_address WHERE GOOD_ID = #{id}")
    List<DetailPicAdress> getGoodsById(long id);

    @Insert("Insert into detail_picture_address(GOOD_ID, PICTURE_ADDRESS) " +
            "values(#{GoodId}, #{PictureAddress})")
    int addGoodsDetailPic(@Param("GoodId") Long GoodId, @Param("PictureAddress") String PictureAddress);

    @Update("UPDATE detail_picture_address SET PICTURE_ADDRESS = #{PICTURE_ADDRESS} WHERE GOOD_ID = #{GOOD_ID}")
    int modifyGoodDetailPic(String PICTURE_ADDRESS, Long GOOD_ID);

    @Delete("DELETE FROM detail_picture_address WHERE GOOD_ID = #{id}")
    int deleteGoodDetailPic(long id);
}
